//搜索框获得焦点/失去焦点函数
function searchfocus_fun(obj){
    var $keywordv = obj.attr("placeholder");
    obj.on("focus",function () {
        $(this).attr("placeholder",'');
    })
    obj.on("blur",function () {
        $(this).attr("placeholder",$keywordv);
    })
}searchfocus_fun($("#keyword"));
searchfocus_fun($("#keywordweb"));
searchfocus_fun($("#keywordwebindex"));

//点击搜索按钮函数
function search(input,btn){
    btn.on("click",function(){
        var kw = input.val();
        if(kw == "" || undefined){
            return false;
        }
        window.location.href="/search.html?k="+kw;
    })
}
search($("#keyword"),$("#search"));
search($("#keywordweb"),$("#searchweb"));
search($("#keywordwebindex"),$("#searchwebindex"));

//回车键函数
function keup_fun(obj) {
    obj.keyup(function (evnet) {
        if (evnet.keyCode == '13') {
            var kw = obj.val();
            if(kw == "" || undefined){
                return false;
            }
            window.location.href="/search.html?k="+kw;
        }
    });
}keup_fun($("#keyword"));
keup_fun($("#keywordweb"));
keup_fun($("#keywordwebindex"));

//手机端导航栏显示隐藏
function menutoggle(){
    $("#phonDown").toggle();
    $(".phone_menu > a").toggleClass("close");
}

//导航栏添加选中样式
function onClassJudge_fun() {
    var $onclassflagV = $("#onclassflag").val();
    $(".onclass").removeClass("on");
    $(".onclass").each(function() {
        var $onclassV = $(this).data("id");
        if ($onclassflagV == $onclassV) {
            $(this).addClass("on");
        }
    })
}onClassJudge_fun();